global path = "****"
global output = "****"

local name= "non_filers"
local date = "062220"
global logname = "$path/`name'_`date'.log"

clear
set more off
set matsize 11000
cd "$path"
log using "$logname", replace

use "$path/pop_2015", clear 
keep if filer==0
drop if state=="GU"|state=="PR"|state=="VI"|state=="AS"| state==""|state=="**"|state=="AA"|state=="."|state=="FM"|state=="AP"|state=="AE"|state=="MP"|state=="MH"|state=="PW"|state=="54"

drop if age>100|age<0
drop if floor(ssa_dod/10000)<2016&ssa_dod~=0

gen female=gnd_ind=="F"
gen age0_18=age>=0&age<=18
gen age19_26=age>=19&age<=26
gen age27_44=age>=27&age<=44
gen age45_64=age>=45&age<=64
gen age65plus=age>=65
gen fpl_frac138=magi_fpl<1.38
gen fpl_frac138_400=magi_fpl>=1.38&magi_fpl<4
gen fpl_frac400=magi_fpl>=4
gen anycov=covered>0
gen fullyear=covered==12
gen long income=11670*magi_fpl
replace income=14580*magi_fpl if state=="AK"
replace income=13420*magi_fpl if state=="HI"
 

/* ages 19-64 */
keep if age19_26==1|age27_44==1|age45_64==1

* no filers statistics
tabstat female age income anycov covered fullyear, s(mean) c(s) save
mat non_filer =  r(StatTotal)'
mat li non_filer

count
mat non_filer =  nullmat(non_filer) \ r(N)
mat li non_filer

clear 
svmat non_filer
save "$output/non_filers_sum_stats_`date'.dta", replace


log close 
